package com.fr.web.core.service;

import com.fr.base.FRContext;
import com.fr.base.core.FRCoreContext;
import com.fr.web.Processor;
import com.fr.web.core.WebUtils;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServerJSService extends NoSessionIDService
{
  private static ServerJSService SERVERJS_SERVICE = new ServerJSService();

  public static ServerJSService getInstance()
  {
    return SERVERJS_SERVICE;
  }

  public boolean accept(String paramString)
  {
    return paramString.startsWith("serverjs_");
  }

  public void process(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString)
    throws Exception
  {
    if ("serverjs_".equals(paramString))
      dealWithServerJS(paramHttpServletRequest, paramHttpServletResponse);
  }

  private static void dealWithServerJS(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse)
    throws Exception
  {
    String str = WebUtils.getHTTPRequestParameter(paramHttpServletRequest, "class");
    if (str == null)
      return;
    Processor localProcessor = null;
    try
    {
      localProcessor = (Processor)FRCoreContext.classForName(str).newInstance();
      localProcessor.dealWithOperation(paramHttpServletRequest, paramHttpServletResponse);
    }
    catch (Exception localException)
    {
      FRContext.getLogger().warning(localException.getMessage());
    }
  }
}